<template>
  <div>
    <button v-on:click="fn">搬砖</button>
    <button @click="fn">搬砖2</button>
    <button @click="huamoney(300000)">娶媳妇</button>
    <button @click="huamoney(200000)">买车</button>
    <button @click="huamoney(800000)">买房</button>

    <div @click="divClick" style="width:200px;height:200px;border:1px solid red">
      <button @click="innerClick($event,100)">内部的button</button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'on-component',
  methods: {
    fn() {
      console.log('事件触发了')
    },
    huamoney(money) {
      console.log('花了' + money + '元')
    },
    divClick(){
      console.log('div点击了');
    },
    innerClick(e,num){
      e.stopPropagation();
      console.log('内部button被点击了');
      console.log(num);
    }
  },
}
</script>

<style></style>
